//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_checknextwf.sqf"
#include "x_setup.sqf"

private ["_grp", "_istaking", "_camps"];
PARAMS_1(_grp);
_grp = _grp call FUNC(getgroup);
__TRACE_1("checknextwf",_grp)
_istaking = GV(_grp,GVAR(takingwf));
if (!isNil "_istaking" && {_istaking}) exitWith {};
_camps = switch (side _grp) do {
	case opfor: {GVAR(blufor_camps)};
	case blufor: {GVAR(opfor_camps)};
};
if (count _camps > 0) then {
	_target_pos = position (_camps call FUNC(RandomArrayVal));
	[_grp, _target_pos] call FUNC(TakeWFWP);
} else {
	// TODO: No camps left, and enough units in group, wait for next target and attack
	// if target is not too far away
};